<template>
  <div>
    <h1>count的值为:{{counterStore.count}}</h1>
    <h1>2*count:{{counterStore.doubleCount}}</h1>
    <button @click="counterStore.increment">+1</button>

    <ul>
      <li v-for="item in counterStore.list" :key="item.id">{{item.name}}</li>
    </ul>
  </div>
</template>


<script setup>
// 1.导入
import {useCounterStore} from '../stores/counter.js'
import {onMounted} from "vue";
// 2.执行方法得到 store 实例对象
const counterStore = useCounterStore()

onMounted(()=> {
  counterStore.getList()
})

</script>


<style>

</style>
